Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a transfer function shader widget #582

Merged
merged 73 commits into from
May 18, 2024

Conversation

seankmartin
Copy link
Contributor

@seankmartin seankmartin commented Apr 19, 2024

Adds a new shader widget directive transferFunction. Transfer functions can be used to map specific data values to color and opacity values via a set of control points. In between control points, the values are linearly interpolated.

A preview of the underlying lookup texture is shown in the UI panel for a transfer function.

Points are added to the panel via a click, their color is changed by setting a new color in the picker, and then right-clicking the point. Points are removed via a modifier and double-click on the point.

seankmartin and others added 30 commits January 31, 2024 18:40
You could accidentally remove points trying to move them before
@seankmartin seankmartin marked this pull request as draft April 19, 2024 16:51
@seankmartin seankmartin marked this pull request as ready for review April 23, 2024 09:49
@seankmartin seankmartin changed the title Feature/transfer function shader widget Add a transfer function shader widget May 3, 2024
@jbms jbms merged commit f805b54 into google:master May 18, 2024
17 of 19 checks passed
@chrisj
Copy link
Contributor

chrisj commented May 21, 2024

@seankmartin
Copy link
Contributor Author

Hey @chrisj, for sure, no worries!

From the link you sent, I've created a transfer function that mimics an invlerp so you can compare here

More generally, you can add points by clicking, change their color by right clicking after selecting a color in the color picker, and remove points by shift double clicking for something like this

At the moment, the transfer function does not show any indication of the underlying data distribution, which can make creating them a little tricky. Let me know if you have questions, happy to help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants